Improve Garmin PVT speed reporting.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 30 Nov 2009 14:13:14 +0000 (14:13 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 30 Nov 2009 14:13:14 +0000 (14:13 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@3829 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/garmin.c

index f25ae9f391e812cfa5e81a98e32153c5612d0be9..6714e82a8a7310d5a9f58c90fd6cf31af8fee36b 100644 (file)
@@ -638,16 +638,13 @@ pvt2wpt(GPS_PPvt_Data pvt, waypoint *wpt)
         wpt->longitude = pvt->lon;
        WAYPT_SET(wpt,course,1);
        WAYPT_SET(wpt,speed,1);
-       /* convert to true course in degrees */
-       if ( pvt->east >= 0.0 )
-               wpt->course = 90 - DEG(atan(pvt->north/pvt->east));
-       else
-               wpt->course = 270 - DEG(atan(pvt->north/pvt->east));
-#if 0
+
+       wpt->course = 180 + DEG(atan2(-pvt->east, -pvt->north));
+
        /* velocity in m/s */
-       wpt->speed = sqrt(pvt->north*pvt->north + pvt->east*pvt->east);
-       wpt->vs = pvt->up;
-#endif
+       WAYPT_SET(wpt,speed, sqrt(pvt->north*pvt->north + pvt->east*pvt->east));
+       // wpt->vs = pvt->up;
+
        /*
         * The unit reports time in three fields:
         * 1) The # of days to most recent Sun. since  1989-12-31 midnight UTC.